$.ajax({
    type: "get",
    url: "/employee/checkRootLogin",
    async: false,
    success: function (res) {
        console.log(res);
        if (res.success) {
            location.href = 'user.html'
        }
    }
});
$(function () {
    $('#loginBtn').on('click', function () {
        var username = $('.form-username').val().trim();
        var password = $('.form-password').val().trim();
        if (!username) {
            alert('请输入用户名');
            $('.form-username').val('')
            return
        }
        if (!password) {
            alert('请输入密码')
            $('.form-password').val('')
            return
        }
        $.ajax({
            type: "post",
            url: "/employee/employeeLogin",
            data: {
                username,
                password
            },
            success: function (res) {
                console.log(res);
                if (res.error) {
                    alert(res.message)
                } else {
                    location.href = 'user.html'
                }
            }
        });
    })
})